<script setup lang="ts">
import { ElDialog } from 'element-plus'
import { toRefs } from 'vue'
// {
//     title:'',
//     width:'',
//     align:'',
// }
const props = withDefaults(defineProps<{
    dialogData?: any
}>(), {
    dialogData: {

    },
})
const emits = defineEmits(['goodSendFn'])
const { dialogData } = toRefs(props)
// console.log(emits);

const visible: any = ref(false)
// 打开
function show() {
    visible.value = true
    emits('goodSendFn', { type: 'show' })
}
// 关闭
function hide() {
    visible.value = false
    emits('goodSendFn', { type: 'hide' })
}
function updataVal() {
    visible.value = true
}
defineExpose({
    updataVal,
})
</script>

<template>
    <ElDialog v-model="visible"
              :title="dialogData.title"
              :width="dialogData.width"
              :align="dialogData.align"
    >
        <slot />

        <template #footer>
            <div class="dialog-footer">
                <el-button type="primary"
                           @click="show()"
                >
                    确认
                </el-button>

                <el-button @click="hide()">
                    取消
                </el-button>
            </div>
        </template>
    </ElDialog>
</template>

<style lang="scss" scoped>
 .pagination {
    margin-top: 20px;
}
</style>
